package item;
import java.awt.Graphics2D;

import bonus.Bonus;

import com.golden.gamedev.object.Sprite;


public class Item
{
    private int type;
    private double x;
    private double y;
    private double py;
    private double vel_y;
    private double time_existed;
    private Sprite bm;
    private Bonus bonus;
    private Item next;
	
	public void draw(Graphics2D context, double akey1)
	{
		for (Item item = this; item != null; item = item.next)
        {
            int x = (int)(item.x + 3 * Math.sin(2*Math.PI * akey1));
            int y = (int)item.y;
            if (4 * item.time_existed < 1 && item.vel_y > 0)
            {
                double t = 4 * item.time_existed;
                int w = (int)(item.bm.getWidth() * t);
                int h = (int)(item.bm.getHeight() * t);
                // BUGBUG: change size
                item.bm.render(context, x - w / 2, y - h / 2);
            }
            else
            {
                item.bm.render(context, x, y);
            }
        }
	}
	public void setType(int type) {
		this.type = type;
	}
	public int getType() {
		return type;
	}
	public void setX(double x) {
		this.x = x;
	}
	public double getX() {
		return x;
	}
	public void setY(double y) {
		this.y = y;
	}
	public double getY() {
		return y;
	}
	public double setPy(double py) {
		this.py = py;
		return py;
	}
	public double getPy() {
		return py;
	}
	public void setVel_y(double vel_y) {
		this.vel_y = vel_y;
	}
	public double getVel_y() {
		return vel_y;
	}
	public void setTime_existed(double time_existed) {
		this.time_existed = time_existed;
	}
	public double getTime_existed() {
		return time_existed;
	}
	public void setSprite(Sprite bm) {
		this.bm = bm;
	}
	public Sprite getSprite() {
		return bm;
	}
	public void setBonus(Bonus bonus) {
		this.bonus = bonus;
	}
	public Bonus getBonus() {
		return bonus;
	}
	public void setNext(Item next) {
		this.next = next;
	}
	public Item getNext() {
		return next;
	}
}